package top.kpromise.user.service_imp;

import org.springframework.stereotype.Service;
import top.kpromise.user.mapper.UserInfoMapper;
import top.kpromise.user.model.response.UserInfoModel;
import top.kpromise.user.service.UserInfoService;
import top.kpromise.user.utils.DateUtils;

@Service
public class UserInfoServiceImp implements UserInfoService {

    private final UserInfoMapper userInfoMapper;

    public UserInfoServiceImp(UserInfoMapper userInfoMapper) {
        this.userInfoMapper = userInfoMapper;
    }

    @Override
    public int insert(UserInfoModel userInfoModel) {
        return userInfoMapper.insert(userInfoModel);
    }

    @Override
    public UserInfoModel getByUserId(String userId) {
        return userInfoMapper.getByUserId(userId);
    }

    @Override
    public int update(UserInfoModel userInfoModel) {
        userInfoModel.setUpdateAt(DateUtils.currentDate());
        return userInfoMapper.update(userInfoModel);
    }
}
